﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace FUSE
{
    class Planet : FUSE.MassedComponent
    {
        private Circle orbitCircle;

        public Planet() : base()
        {
            this.Name = nameGen();
            this.orbitCircle = new Circle();
            base.points = 0;
        }

        public Planet(int mass, int points)
            : base(mass)
        {
            base.Name = nameGen();
            this.points = points;

            this.orbitCircle = new Circle();
            this.orbitCircle.SetPosition(Vector2.Zero);
        }



        public override void Initialize()
        {
            points = 0;

            base.Initialize();

            orbitCircle.centerPOS = ComponentBounds.centerPOS;
        }

        public override void LoadContent(Texture2D texture)
        {
            base.LoadContent(texture);

            orbitCircle.radius = ComponentBounds.radius + (ComponentBounds.radius * 0.60f);
        }

        public override void SetRenderPosition(float xCoord, float yCoord)
        {
            base.SetRenderPosition(xCoord, yCoord);

            orbitCircle.SetPosition(ComponentBounds.centerPOS);
            
        }

        public override void SetCenterPosition(float xCoord, float yCoord)
        {
            base.SetCenterPosition(xCoord, yCoord);

            orbitCircle.SetPosition(ComponentBounds.centerPOS);
        }

        private string nameGen()
        {
            string newName;
            //make random name generator, thinking consonant-vowel-consonant-vowel-consonant-consonant-vowel, random numbers 0-19 = consonant 20-25 = vowel
            Random numGen = new Random();
            String letter1 = Consonants[numGen.Next(19)];
            String letter2 = vowels[numGen.Next(6)];
            String letter3 = consonants[numGen.Next(19)];
            String letter4 = vowels[numGen.Next(6)];
            String letter5 = consonants[numGen.Next(19)];
            String letter6 = consonants[numGen.Next(19)];
            String letter7 = vowels[numGen.Next(6)];
            newName = letter1+letter2+letter3+letter4+letter5+letter6+letter7;

            //var vowels = new Array("a", "e", "i", "o", "u");
            //var consts = new Array("b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "r", "s", "t", "v", "w", "x", "z");

            return newName;
        }

        public Circle OrbitCircle
        {
            get { return orbitCircle; }
        }


    }
}
